<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css" />
    <link rel="stylesheet" href="/css/community.css" />
    <link rel="stylesheet" href="/css/editormd.min.css" />
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js" ></script>
    <script src="/js/community.js" ></script>
    <script src="/js/editormd.min.js" ></script>
    <title>Hello</title>
</head>
<body>
<div th:insert="~{header :: header-nav}"></div>

<div class="container-fluid main">
    <div class="row">
        <div  class="col-lg-9 col-md-12 col-md-12 col-md-12">
            <h2> <span class="glyphicon glyphicon-plus" aria-hidden="true">发起</span></h2>
            <hr>
            <form action="/publish" method="post">
                <input type="hidden" name = "id" th:value="${id}">
                <div class="form-group">
                    <label for="title">问题标题(简单扼要)</label>
                    <input type="text" class="form-control" name="title" id="title" placeholder="问题标题..." th:value="${title}" autocomplete="off">
                </div>
                <div class="form-group" id="publish-editor">
                    <label for="content">问题补充(必填，请参照右侧提示)</label>
                    <textarea id="content" rows="10" cols="30" name="description" class="form-control" th:text="${description}" style="display: none"></textarea>
                </div>
                <script type="text/javascript">
                    $(function() {
                        var editor = editormd("publish-editor", {
                            width: "100%",
                            height: "350",
                            path : "/js/lib/",  //
                            delay:0,
                            watch:false

                        });
                    });
                </script>

                <div class="form-group">
                    <label for="tag">添加标签(以逗号分隔)</label>
                    <input type="text" class="form-control" name="tag" id="tag" placeholder="添加标签" th:value="${tag}" onclick="showSelectTag()" autocomplete="off">

                    <!--规范化标签库-->
                    <div id="select-tag" class="public-div-tag">
                        <ul class="nav nav-tabs" role="tablist" >
                            <li role="presentation"  th:each="tagInfo:${tags}" ><a  aria-controls="home" role="tab" data-toggle="tab" th:href="@{'#'+${tagInfo.categoryName}}" th:text="${tagInfo.categoryName}">
                            </a>
                            </li>
                        </ul>
                        <!-- 标签内容-->
                        <div class="tab-content">
                            <div role="tabpanel" class="tab-pane "  th:each="tagInfo:${tags}"  th:id="${tagInfo.categoryName}"  >
                                 <span class="glyphicon glyphicon-tag label label-info question-tag" aria-hidden="true" th:each="selectTag:${tagInfo.tags}">
                                    <span th:text="${selectTag}" onclick="selectTag(this)" th:data-tag="${selectTag}">
                                    </span>
                                    </span>
                            </div>
                        </div>

                    </div>

                </div>
                <div class="alert alert-danger" role="alert" th:text="${error}" th:if="${error!=null}">

                </div>
                <button type="submit" class="btn btn-success btn-publish">确认发布</button>

            </form>
        </div>
        <div  class="col-lg-3 col-md-12 col-md-12 col-md-12">
            <h3>问题发起指南</h3>
            • 问题标题: 请用精简的语言描述您发布的问题，不超过25字 <br>
            • 问题补充: 详细补充您的问题内容，并确保问题描述清晰直观, 并提供一些相关的资料<br>
            • 选择标签: 选择一个或者多个合适的标签，用逗号隔开，每个标签不超过10个字<br>
        </div>
    </div>
</div>
<div class="footer">
    <div th:insert="~{footer :: foot}"></div>
</div>
</body>
</html>